function love.graphics.transform(ox, oy, xx, xy, yx, yy)
  local ex, ey, fx,fy = xx-ox, xy-oy, yx-ox, yy-oy
  if ex*fy<ey*fx then ex,ey,fx,fy=fx,fy,ex,ey end
  local e,f = math.sqrt(ex*ex+ey*ey), math.sqrt(fx*fx+fy*fy)
  
  ex,ey = ex/e, ey/e
  fx,fy = fx/f, fy/f
  
  local desiredOrientation=math.atan2(ey+fy,ex+fx)
  local desiredAngle=math.acos(ex*fx+ey*fy)/2
  local z=math.tan(desiredAngle)
  local distortion=math.sqrt((1+z*z)/2)
  
  love.graphics.translate(ox, oy)
  love.graphics.rotate(desiredOrientation)
  love.graphics.scale(1, z)
  love.graphics.rotate(-math.pi/4)
  love.graphics.scale(e/distortion,f/distortion)

end

function love.graphics.getResolution()
  return love.graphics.getWidth(), love.graphics.getHeight()
end


local imageCache = {}
local newImage=love.graphics.newImage
function love.graphics.newImage(filename)
  imageCache[filename]=imageCache[filename] or newImage(filename)
  return imageCache[filename]
end




local function rgba2c(r,g,b,a) return r*256*256+g*256+b+(a and (255-a)*256*256*256 or 0) end
local function c2rgba(c)
  local r,g,b,a
  b=c%256 c=(c-b)/256
  g=c%256 c=(c-g)/256
  r=c%256 c=(c-r)/256
  if c>0 then a=255-c end
return r,g,b,a end
local setColor=love.graphics.setColor
function love.graphics.setColor(r,g,b,a)
  if not g then setColor(c2rgba(r))
  else setColor(r,g,b,a) end
end
function love.graphics.blendColors(color1,color2,color1weight)
  local r1,g1,b1,a1=c2rgba(color1)
  local r2,g2,b2,a2=c2rgba(color2)
  return rgba2c(
    math.floor(color1weight*r1+(1-color1weight)*r2), 
    math.floor(color1weight*g1+(1-color1weight)*g2), 
    math.floor(color1weight*b1+(1-color1weight)*b2), 
    a1 and a2 and math.floor(color1weight*a1+(1-color1weight)*a2) or nil)
end

function love.run() while (love.im.tick()) do love.graphics.print("need a love.run function",3,3) end end
love.im={} --immediate mode
local x,y=0,0
local printY=0
function love.im.tick()
  printY=0
  love.timer.sleep(0.001)
  love.graphics.present()
  love.timer.step()
  love.graphics.clear()
  love.im.mousePressed = nil
  love.im.mouseReleased = nil
  love.im.mouseDX = nil
  love.im.mouseDY = nil
  love.im.keyPressed = nil
  love.im.keyReleased = nil
  love.event.pump()
  e,a,b,c,d=love.event.poll()()
  local mx,my=love.mouse.getPosition()
  if x~=mx or y~=my then love.im.mouseDX,love.im.mouseDY,x,y=mx-x,my-y,mx,my end
  if e=="mousepressed" then love.im.mousePressed=c
  elseif e=="mousereleased" then love.im.mouseReleased=c
  elseif e=="keypressed" then love.im.keyPressed=a
  elseif e=="keyreleased" then love.im.keyReleased=a
  elseif e=='quit' then love.audio.stop() return false end
return true end

function love.im.print(...)
  local args={...}
  for i,v in ipairs(args) do args[i]=tostring(v) end
  love.graphics.print(table.concat(args, " "),5,printY)
  printY=printY+15
end
